<?php
ini_set('display_errors',1);

error_reporting(E_ALL);

defined('_JEXEC') or die('Restricted access');
 
require_once(JPATH_COMPONENT.DS.'constants.php');
require_once(JPATH_COMPONENT.DS.'controller.php');

$session =& JFactory::getSession();

jimport('phpxmlrpc.xmlrpc');
 
$global_controller = new RetailShopController();	

$controllers = array();

$controllers[] = 'home';
$controllers[] = 'myshop';
$controllers[] = 'mainlayout';

if (in_array(getRequest('view'),$controllers))
{
	require_once(JPATH_COMPONENT.DS.'controllers'.DS.getRequest('view').'.php');
	
	$controller = 'RetailShopController'.getRequest('view');
    		
	$controller = new $controller();
	
	switch(getRequest('view'))
	{		
		case 'home' :
			$controller->registerTask('view','view');
            $controller->registerTask('addnewshop','addnewshop');
            $controller->registerTask('defaultcity','defaultcity');
            $controller->registerTask('detailscatelog','detailscatelog');
            $controller->registerTask('display','display');
            $controller->registerTask('events','events');
            $controller->registerTask('findthelocalfreashop','findthelocalfreashop');
            $controller->registerTask('listalldeal','listalldeal');
            $controller->registerTask('listcity','listcity');
            $controller->registerTask('retailshop','retailshop');
            $controller->registerTask('saveshop','saveshop');
            $controller->registerTask('search','search');
            $controller->registerTask('startretailshop','startretailshop');			
			break;	
            	
		case 'myshop':
			$controller->registerTask('add','add');
            $controller->registerTask('addcomment','addcomment');
            $controller->registerTask('addnew','addnew');
            $controller->registerTask('defaultshop','defaultshop');
            $controller->registerTask('delete','delete');
            $controller->registerTask('display','display');
            $controller->registerTask('editevnet','editevnet');
            $controller->registerTask('limit','limit');
            $controller->registerTask('limitalldeal','limitalldeal');
            $controller->registerTask('limitevent','limitevent');
            $controller->registerTask('limitproduct','limitproduct');
            $controller->registerTask('limitproduct2','limitproduct2');
            $controller->registerTask('newcategory','newcategory');
            $controller->registerTask('newevent','newevent');
            $controller->registerTask('productdetail','productdetail');
            $controller->registerTask('products','products');
            $controller->registerTask('save','save');
            $controller->registerTask('savecate','savecate');
            $controller->registerTask('saveevent','saveevent');
            $controller->registerTask('saveslide','saveslide');
            $controller->registerTask('setting','setting');			
			break;
            
		case 'mainlayout':
			$controller->registerTask('view','view');			
			break;					
	}
}
else
{
	$controller =& $global_controller;
}

$controller->execute(getRequest('task',NULL,'default','cmd'));

$controller->redirect();
